import * as slaveRuntimePlugin from '@/qiankun/slaveRuntimePlugin';
import { PluginManager } from './client/plugin';

export function getPlugins() {
  return [
    {
      apply: slaveRuntimePlugin,
      path: void 0,
    },
  ];
}

export function getValidKeys() {
  return ['patchRoutes', 'patchClientRoutes', 'modifyContextOpts', 'modifyClientRenderOpts', 'render', 'onRouteChange', 'qiankun', 'useQiankunStateForSlave'];
}

let pluginManager: PluginManager;

export function createPluginManager() {
  pluginManager = PluginManager.create({
    plugins: getPlugins(),
    validKeys: getValidKeys(),
  });
  return pluginManager;
}

export function getPluginManager() {
  return pluginManager;
}
